Synchronization within wireless devices

ABSTRACT

Synchronizing a wireless sensor includes receiving a first command at the wireless sensor, noting a first timestamp value indicating when the first reply is sent, responding to the first command with a first reply, receiving a second command at the wireless sensor that contains a second timestamp value indicating when the first reply was received and a third timestamp value indicating when the second command was sent to the wireless sensor, noting a fourth timestamp value indicating when the second command was received by the wireless sensor, and determining an offset at the wireless sensor using the first, second, third, and fourth timestamp values. The presence of the first timestamp value may be interpreted as a request to provide timestamp information for synchronization. An access point may communicate with the wireless sensor.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation-in-part of U.S. patent application Ser. No. 12/799,087 filed on Apr. 16, 2010 (pending), and is a continuation-in-part of U.S. patent application Ser. No. 13/134,339 filed on Jun. 6, 2011 (pending), both of which are incorporated by reference herein.

TECHNICAL FIELD

This application relates to the field of wireless communication and, more particularly, to the field of synchronizing wireless devices.

BACKGROUND OF THE INVENTION

Systems exist that use a plurality of sensors to collect data and to use that data in connection with sensing, monitoring and control functionality. Aircraft monitoring systems may use a plurality of sensors that provide sensed data to one or more central processors that use the data to assess the health of system components. For example, U.S. Pat. No. 6,847,917 to Bechhoefer, which is incorporated by reference herein, discloses determining a health indicator of a component using condition indicators (CIs) to parameterize characteristics about a component. The CIs are based on sensed data for the component and facilitate condition-based (rather than schedule-based) maintenance.

Wireless communication is being considered as a replacement for wired data transfer, particularly in avionics systems. Potential advantages of using wireless communication as opposed to wired connections include lower weight, reduced design complexity, easier system reconfiguration, improved diagnostic capabilities, simplified installation and/or easier maintenance. For example, retrofitting new sub-systems into existing aircraft may become substantially easier and cheaper if no new wiring has to be designed and installed, and the use of a large number of sensors to monitor an aircraft's state may become more realistic if it does not lead to an increased amount of wiring. Further, wireless communication may enable the introduction of new sensing technologies into new aircraft design and/or existing aircraft as retrofit options. For the wireless approach to become practically viable, however, it must deliver a level of performance comparable to wired systems, and stringent performance requirements may need to be satisfied. Aircraft applications typically require very high reliability, i.e. data loss has to be very infrequent. The required probability of lost data may be several orders of magnitude lower than that typically considered acceptable by vendors of commercial wireless components. In addition, data latency requirements may be quite strict and a high precision of synchronization may be required.

Synchronization issues arise when multiple devices need to perform the same action at the same time. For example, mechanical diagnostics may involve collection of vibration data from multiple accelerometers. The difference in phase between the vibration signals may be used, among other features, to infer information about the mechanical health of the aircraft. In order to extract phase information, it may therefore be necessary that the acceleration data samples be acquired from different sensors starting at the same time. This may not be achieved, however, by simultaneously commanding all sensor nodes to immediately acquire data since wireless communication can be subject to unpredictable packet losses that may necessitate retransmissions to some of the nodes. Also, transfer of information to and from transceiver modules may be subject to unpredictable delays. Because of this, the same data acquisition command broadcasted to several destinations may reach the sensors at different time instances. This, in turn, may result in different sensors starting data acquisition at different times, leading to incorrect mechanical health information. Accordingly, to be effective, a wireless communication system must address synchronization issues among sensors.

Known wireless transfer systems include synchronization mechanisms internal to their communication protocols. For example, in the IEEE 802.11 standard, the time synchronization function (TSF) provides synchronization in connection with beacon messages transmitted periodically by a single node. However, the internal synchronization information of the wireless transceiver may not be available to an attached device, such as a sensor device, and thus synchronization among multiple sensor devices is still performed through the exchange of time data among the sensors, which remains subject to unpredictable and random transmission delays. For a discussion of known synchronization techniques among wireless devices, see Holger Karl and Andreas Willig, “Protocols and architectures for wireless sensor networks,” Wiley, 2005.

Techniques may be available for having one or more central nodes or controllers synchronize wireless sensors. However, depending on the number of sensors involved, the central node(s) may not have the processing capacity to handle the synchronization processing for all of the sensors. In addition, centralized synchronization may be difficult in situations where the sensors are procured from different sources. Furthermore, different sensors (different types of sensors) may need different levels of synchronization, which may be difficult to manage with a central node. Accordingly, it is desirable to provide a wireless communication system that may be suitably used in connection with sensing, monitoring and control systems, such as avionics systems, that can be synchronized without the need for a centralized node to perform all or nearly all of the synchronization processing.

SUMMARY OF THE INVENTION

According to the system described herein, synchronizing a wireless sensor includes receiving a first command at the wireless sensor, responding to the first command with a first reply, noting a first timestamp value indicating when the first reply is sent, receiving a second command at the wireless sensor that contains a second timestamp value indicating when the first reply was received and a third timestamp value indicating when the second command was sent to the wireless sensor, noting a fourth timestamp value indicating when the second command was received by the wireless sensor, and determining an offset at the wireless sensor using the first, second, third, and fourth timestamp values. The offset may be determined using the formula: Offset=((the second timestamp value minus the first timestamp value)−(the fourth timestamp value minus the third timestamp value))/2. The first timestamp value may be provided with the first reply. The presence of the first timestamp value may be interpreted as a request to provide timestamp information for synchronization. An access point may communicate with the wireless sensor. The second timestamp value may be the time that the first reply is received by the access point and the third timestamp value may be the time that the second command is sent by the access point. The wireless sensor may be synchronized according to a clock of the access point. The first command may be a request to collect data. The wireless sensor may be one of a plurality of wireless sensors and each of the wireless sensors may collect data in synchronization with other ones of the wireless sensors. Exchanges for synchronizing the wireless sensors may overlap. The first reply may indicate a requested number of exchanges. Substantially all commands received by the wireless sensor may include timestamp values.

According further to the system described herein, computer software, provided in a non-transitory computer-readable medium, synchronizes a wireless sensor. The software includes executable code that receives a first command at the wireless sensor, executable code that responds to the first command with a first reply, executable code that notes a first timestamp value indicating when the first reply is sent, executable code that receives a second command at the wireless sensor that contains a second timestamp value indicating when the first reply was received and a third timestamp value indicating when the second command was sent to the wireless sensor, executable code that notes a fourth timestamp value indicating when the second command was received by the wireless sensor, and executable code that determines an offset at the wireless sensor using the first, second, third, and fourth timestamp values. The offset may be determined using the formula: Offset=((the second timestamp value minus the first timestamp value)−(the fourth timestamp value minus the third timestamp value))/2. The first timestamp value may be provided with the first reply. The second timestamp value may be the time that the first reply is received by an access point that communicates with the wireless sensor and the third timestamp value may be the time that the second command is sent by the access point. The wireless sensor may be synchronized according to a clock of an access point that communicates with the wireless sensor. The wireless sensor may be one of a plurality of wireless sensors and exchanges for synchronizing the wireless sensors may overlap. The first reply may indicate a requested number of exchanges. Substantially all commands received by the wireless sensor may include timestamp values.

BRIEF DESCRIPTION OF THE DRAWINGS

Embodiments of the system are described with reference to the several figures of the drawings that are briefly described as follows.

FIG. 1 is a schematic illustration of a wireless sensor system including an access point (AP) and a plurality of sensors according to an embodiment of the system described herein.

FIG. 2A is a schematic illustration of a sensor and corresponding components thereof according to an embodiment of the system described herein.

FIG. 2B is a schematic illustration of an access point and corresponding components thereof according to an embodiment of the system described herein.

FIG. 3 is a flow chart illustrating basic operation of a sensor according to an embodiment of the system described herein.

FIG. 4 is a flow chart illustrating a sensor receiving a message/command from an AP according to an embodiment of the system described herein.

FIG. 5 is a flow chart of a sensor sending a message/data according to an embodiment of the system described herein.

FIG. 6 is a flow chart illustrating an AP transmitting a sleep command to one or more sensors according to an embodiment of the system described herein.

FIG. 7 is a flow chart illustrating processing performed by a sensor in connection with waking up according to an embodiment of the system described herein.

FIG. 8 is a flow chart illustrating processing performed by a sensor in connection with receiving a message/command according to an embodiment of the system described herein.

FIG. 9 is a schematic diagram illustrating a table used by a sensor to correlate identifiers and retry counts according to an embodiment of the system described herein.

FIG. 10 is a flow chart illustrating processing performed by an AP in connection with transmission of a message/command to a sensor.

FIG. 11 is a flow chart illustrating processing performed by a sensor in connection with handling a data collection request according to an embodiment of the system described herein.

FIG. 12 is a flow chart in connection with an AP requesting collected data from a sensor according to an embodiment of the system described herein.

FIG. 13 shows a timing diagram according to an embodiment of the system described herein in connection with the AP, as a control node, broadcasting N reference messages to sensor nodes N1 and N2.

FIG. 14 shows a timing diagram that illustrates an algorithm variant in which an additional round of reference broadcasts is used in case of unexpected message losses.

FIGS. 15A and 15B show a flow diagram for an algorithm according to an embodiment of the system described herein for achieving synchronization using the broadcasting of reference messages from the AP.

FIG. 16 is a timing diagram showing timestamping of messages exchanged between two devices (the AP and the sensor node N2) in connection with an embodiment of the system described herein to address issues of accurate synchronization between the AP and individual sensors

FIG. 17 is a flow diagram showing an algorithm according to the system described herein that may be executed by the AP in connection with estimating relative offsets.

FIG. 18 shows a timing diagram for randomized transmission time instants according to an embodiment of the system described herein.

FIG. 19 is a flow diagram showing a timing algorithm for randomized transmission time instances performed on the AP side according to an embodiment of the system described herein.

FIG. 20 is a flow diagram showing a timing algorithm for randomized transmission time instances on the sensor node N2 side according to an embodiment of the system described herein.

FIG. 21 is a timing diagram showing selection of uniformly spaced message transmission times according to an embodiment of the system described herein.

FIG. 22 shows a flow diagram showing a timing algorithm for uniformly spaced transmission times performed on the AP side according to an embodiment of the system described herein.

FIG. 23 is a flow diagram showing a timing algorithm for uniformly distributed transmission times on the sensor node N2 side according to an embodiment of the system described herein.

FIG. 24 is a flow diagram illustrating wireless sensor data acquisition according to an embodiment of the system described herein.

FIG. 25 is a flow chart illustrating an AP requesting collected data from and exchanging time synchronization information with a wireless sensor according to an embodiment of the system described herein.

FIG. 26 is a flow chart illustrating determining a number of data segment and extra time synchronization exchanges according to an embodiment of the system described herein.

FIG. 27 is a diagram illustrating compensating data for clock offsets according to an embodiment of the system described herein.

FIG. 28 is a flow chart illustrating determining data to discard to compensate for clock offsets according to an embodiment of the system described herein.

FIG. 29 is a timing diagram illustrating acquiring data and exchanging timing information according to an embodiment of the system described herein.

FIG. 30 is a timing diagram illustrating exchanging timing information to facilitate sensor self-synchronization according to an embodiment of the system described herein.

FIG. 31 is a flow chart illustrating processing performed by an AP to facilitate sensor self-synchronization according to an embodiment of the system described herein.

FIG. 32 is a flow chart illustrating processing performed by a sensor for sensor self-synchronization according to an embodiment of the system described herein.

DETAILED DESCRIPTION OF VARIOUS EMBODIMENTS

FIG. 1 is a schematic illustration of a wireless sensor system 30 that includes a wireless access point (AP) 32 and a plurality of wireless sensors N1, N2, . . . Nx 34-36. The AP 32 exchanges digital data with the sensors 34-36 including sensor data, status information, commands, etc. The AP 32 may include a computer readable storage medium and one or more processors to perform various functions as further discussed elsewhere herein. In an embodiment herein, the sensors 34-36 may be aircraft sensors used to measure aircraft parameters such as temperature, vibration, etc. However, the sensors 34-36 may represent any appropriate wireless data transceiver and thus, reference herein to the sensors 34-36 and/or a subset of the sensors 34-36 should be understood to include a general reference to a wireless data transceiver. Furthermore, there may be any appropriate number of sensors/data transceivers used to provide the functionality described herein. Similarly, although the system described herein is illustrated with the one AP 32, it is possible to use any appropriate number of other AP's to provide the functionality described herein. For example, it may be possible to provide redundant ones of the AP's and/or sensors that take over primary operation upon failure of a corresponding component. Reference is made to co-pending application U.S. patent application Ser. No. 12/156,572 to Zakrzewski, entitled “Wireless Sensor System,” filed Jun. 3, 2008, which is incorporated herein by reference.

The AP 32 and the sensors 34-36 communicate using an appropriate wireless frequency and/or protocol in accordance with the system described herein. In various embodiments, the AP and sensor nodes may use off-the-shelf wireless communication devices to communicate wirelessly. The system described herein facilitates wireless digital data communication with variable sized or fixed sized data packets. In some cases, it may be useful to use variable sized data packets to facilitate adjusting the data packet size according to the quality of the wireless data link. A relatively good link favors larger packet sizes to improve data throughput while, conversely, a relatively bad link favors smaller packet sizes.

Synchronization of multiple wireless devices may be provided by estimating the relative clock offsets between the devices. One method for estimating relative clock offsets between devices is known as the Reference Broadcast Synchronization (RBS) method in which multiple nodes use messages from the same sender to mutually synchronize their internal clocks. In RBS, the control node sends a series of broadcast messages which are time-stamped upon receipt by the multiple nodes. Then, the receipt timestamps are exchanged between the receiver nodes so that each may calculate its estimated clock offset relative to other receivers. It is noted, however, that, in accordance with discussion of known synchronization techniques elsewhere herein, a disadvantage of the RBS method is that it requires message traffic between subordinate sensor nodes. Allowing message exchanges initiated by individual sensors may undesirably lead to message collisions and network indeterminism. Furthermore, individual sensor pairs may be outside of each other's transmission reach, requiring the use of increased signal power or multi-hop transmissions to provide full determinism of the sensor network.

According to various embodiments of the system described herein, direct sensor-to-sensor traffic may be eliminated and all sensors may instead communicate only with a central node in connection with synchronization, for example in a star network configuration. In accordance with timestamp information received from individual sensors at the central node, instead of commanding the sensors to start data acquisition immediately, the central control node may select a time instant in the future and calculate the clock values of the sensor devices to correspond to the same chosen future time instant. Those clock values may then be used in connection with the timing of data acquisition commands sent to the sensors. Based on the clock values sent from the central node, the internal clocks of the sensors may be synchronized through clock adjustment and/or the data acquisition commands may be sent to different sensor devices specifying different starting times according to the calculated relative offsets of the different sensor devices in a way that causes the different sensor devices to act at the same physical time instant. A description of various techniques for performing wireless device synchronization are provided in detail elsewhere herein.

In an embodiment, the AP 32 may act as a central node in a star network that includes the sensors 34-36. In various embodiments, the AP 32 may be implemented using any appropriate hardware, such as an off-the-shelf processor and/or transceiver hardware capable of providing the functionality described herein. In an embodiment, the AP 32 may be powered externally so that, generally, operation of the AP 32 does not require significant conservation of power. The sensors 34-36, on the other hand, may have constraints that necessitate conserving power in connection with operation thereof, as further discussed elsewhere herein.

Each of the sensors 34-36 may communicate directly with the AP 32 and vice versa so that the sensors 34-36 do not necessarily communicate with each other. In addition, in an embodiment herein, each of the sensors 34-36 may be individually addressable by the AP 32 and the sensors 34-36 may not transmit anything unless specifically requested to do so by the AP 32. Such an arrangement may reduce the likelihood of wireless data collisions. Of course, special provisions may be made for initial configuration so that the AP 32 can learn the identity of new sensors. As described in more detail elsewhere herein, in some instances, one or more of the sensors 34-36 may enter a low power state (sleep) for a predetermined amount of time and then enter a different state to receive transmissions (requests) from the AP 32, if any.

In FIG. 2A, an embodiment of the sensor 34 is shown in more detail as including sensor components 42, a microcontroller or other processor 44, a transceiver 46, a memory 48, and a power source 52. The other sensors 35, 35 may have a similar configuration as the sensor 34. The sensor components 42 may provide appropriate sensing functionality according to the particular application. For example, the sensor components 42 may include temperature sensing components, vibration sensing components, etc. Of course, in embodiments where other types of wireless data devices are used instead of sensors 34-36, then the sensor components 42 may be replaced with another type of data source/interface, as appropriate. Note that, the transceiver 46 should be understood as including a single transceiver chip or a more complicated circuit/board that may include more components. Similarly, the processor 44 may be understood as including a single processor chip, or a more involved circuit/board. Accordingly, the components illustrated herein denote functional blocks that perform certain functions, rather than necessarily representing particular discrete components. In that regard, the system described herein may be implemented using a single chip that combines transceiver and processor functions, and possibly also includes some memory.

The processor 44 may be coupled to, and receive data from, the sensor components 42. The processor 44 may be any type of processor capable of providing the functionality described herein. The processor 44 may consume relatively little power and be capable of being placed in an idle (sleep) mode that consumes even less power or possibly even no power at all. The processor 44 may include a timer that functions as further described elsewhere herein, for example, a high precision (sub-millisecond) timer that may be restarted when the sensor node wakes up from a sleep node.

The transceiver 46 may be coupled to the processor 44 and handle wireless communication between the sensor 34 and the AP. In an embodiment herein, the transceiver 46 may communicate with the AP 32 using the IEEE 802.15.4 protocol, possibly adapted for higher data rates, or use any other appropriate protocol, including protocols that provide for high speed packet based digital data exchange. In some instances, it may be possible to use the IEEE 802.11 protocol with UDP. In some embodiments, the frequencies of 2.4 GHz and 5.8 GHz may be avoided in order to reduce the likelihood of interference from consumer electronics, such as cell phones, wireless data networks, etc. Of course, the system described herein does not depend upon the use of any particular communication protocol or class of protocols and does not depend on the use of any particular frequency or frequencies.

The memory 48 may be coupled to the sensor components 42 and the processor 44 and may be used to store data retrieved by the sensor components 42, temporary data generated by the processor 44 in connection with operation thereof, etc. In an embodiment herein, the memory may be volatile memory (e.g., semiconductor RAM) while the processor 44 uses non-volatile memory (not shown) for software thereof that includes processor instructions, constant data values used for execution, etc. Of course, any appropriate type of memory may be used.

The power source 52 is coupled to the sensor components 42, the processor 44, the transceiver 46, and the memory 48. The power source 52 may be a battery (rechargeable or not), a fuel cell, or any other component capable of generating electrical power for operation of electronic portions of the sensor 34. The system described herein may conserve power of the sensors 34-36 (i.e., power from the power source 52) to minimize the frequency at which the power source 52 needs to be replaced, recharged, or otherwise renewed. Note, however, that it may be assumed that the AP 32 is coupled to an external power source and thus does not have similar power use issues.

In FIG. 2B, an embodiment of the AP 32 is shown in more detail as including a microcontroller or other processor 62, a transceiver 64, a memory 66, and a power source 68. Note that the transceiver 64 should be understood as including a single transceiver chip or a more complicated circuit/board that may include more components. Similarly, the processor 62 may be understood as including a single processor chip, or a more involved circuit/board. Accordingly, the components illustrated herein denote functional blocks that perform certain functions, rather than necessarily representing particular discrete components. In that regard, the system described herein may be implemented using a single chip that combines transceiver and processor functions, and possibly also includes some memory.

The processor 62 may be any type of processor capable of providing the functionality described herein. In an embodiment, the processor 62 may include a timer that functions as further described elsewhere herein, for example, having a similar accuracy as the timer discussed with respect to the processor 44 of the sensor node 34. The transceiver 64 may be coupled to the processor 62 and handle wireless communication between the AP 32 and the sensors 34-36. In an embodiment herein, the transceiver 64 may communicate with one or more of the sensors 34-36 using the IEEE 802.15.4 protocol, possibly adapted for higher data rates, or use any other appropriate protocol, including protocols that provide for high speed packet based digital data exchange. In some instances, it may be possible to use the IEEE 802.11 protocol with UDP. In some embodiments, the frequencies of 2.4 GHz and 5.8 GHz may be avoided in order to reduce the likelihood of interference from consumer electronics, such as cell phones, wireless data networks, etc. Of course, the system described herein does not depend upon the use of any particular communication protocol or class of protocols and does not depend on the use of any particular frequency or frequencies.

The memory 66 may be coupled to the processor 62 and may be used to store data generated by the processor 62 in connection with operation thereof, etc. In an embodiment herein, the memory 66 may be volatile memory (e.g., semiconductor RAM) while the processor 62 uses non-volatile memory (not shown) for software thereof that includes processor instructions, constant data values used for execution, etc. Of course, any appropriate type of memory may be used.

The power source 68 may be coupled to the processor 62, the transceiver 64, and the memory 66. The power source 68 may be a battery (rechargeable or not), a fuel cell, or any other component capable of generating electrical power for operation of electronic portions of the AP 32. Alternatively, in other embodiments, the AP 32 may be coupled to an external power source. Accordingly, although power of the AP 32 may be conserved like that discussed herein in connection with the sensors 34-36, in embodiments where the AP 32 is coupled to an external power source, power conservation may not be required and power use not an issue.

FIG. 3 shows a flow chart 70 illustrating steps performed by each of the sensors 34-36 at the direction of the AP 32. Generally, a sensor operates in a reduced power usage state (sleeps) for a predetermined amount of time before waking up to see if the AP 32 is communicating therewith. If the AP 32 is not communicating with the sensor, the sensor goes back to sleep. There may be different sleep modes, different amounts of time a sensor spends sleeping each cycle, different amounts of time a sensor waits for communication from the AP 32, etc., all of which is explained in more detail elsewhere herein.

Processing for the flow chart 70 begins at a step 72 where the sensor sleeps. In an embodiment herein, the sensor sleeps by powering down some or all components except those necessary to maintain the sleep time for each cycle and to wake up the sensor when the sleep time expires. Since it is desirable to conserve power, then, ideally, as many components as possible may be powered down. In some embodiments, there may be two sleep modes: a shallow sleep mode where the volatile memory 48 is not powered down during the sleep cycle, thus retaining data, state information, etc., and a deep sleep mode where the memory 48 is powered down, thus causing any data stored therein to be lost. The sleep time for shallow sleep may be shorter than that for deep sleep. For example, the sleep time for shallow sleep may be two seconds while the sleep time for deep sleep may be forty seconds. Of course, other times may be used. The deep sleep mode may be used when the aircraft is not in use (e.g., on the ground in a hangar) while the shallow sleep mode may be used, for example, between data collection cycles during operation of the aircraft. Note, of course, that it may be possible to provide any number of different sleep modes having different characteristics, cycle times, etc.

Following the step 72 is a test step 74 where the sensor wakes up (leaves the sleep state) and determines if the AP 32 is communicating with the sensor. In an embodiment herein, the sensor remains awake for one millisecond to wait for a communication from the AP 32. Of course, a different amount of awake time may be used. If no communication comes while the sensor is awake, then control transfers from the test step 74 back to the step 72 to sleep for another cycle. Otherwise, control transfers from the test step 74 to a step 76 where the sensor receives the communication from the AP 32. Following the step 76 is a step 78 where the sensor takes whatever action is indicated by the communication received at the step 76. As discussed in more detail elsewhere herein, the actions may include providing status information, scheduling a sensor reading, returning sensor data, adjusting the sensor internal clock, etc. Following the step 78, control transfers back to the step 72, discussed above, for another iteration.

FIG. 4 shows a flow chart 90 that illustrates steps performed in connection with a sensor receiving a message/command from the AP 32. Processing begins at a first step 92 where the sensor receives the data (message/command) transmitted by the AP 32. Following the step 92 is a step 94 where the sensor obtains its own internal time information. Each of the sensors 34-36, and the AP 32, have an internal timing mechanism that may be adjusted, as described in more detail elsewhere herein. Following the step 94 is a step 96 where the time data obtained at the step 94 is appended to the received message. Use of the time information to determine when and how to adjust internal timing mechanisms is discussed in more detail elsewhere herein.

Following the step 96 is a step 98 where the received message is stored (i.e., in the memory 48). Following the step 98 is a test step 102 where it is determined if there is more data (for the command/message) to be received. In various embodiments, the information may be transmitted using fixed length and/or variable length packets. In an embodiment using variable length data packets, the length may be adjusted based on the quality of the wireless communication link between the sensor and the AP 32. Thus, it may be possible for a particular command/message to span more than one data packet. If it is determined at the test step 102 that there is not more data to be received, then processing is complete. Otherwise, control transfers back to the step 92 to receive the additional data.

FIG. 5 shows a flow chart 110 that illustrates steps performed in connection with a sensor sending information (message/data) to the AP 32. Processing begins at a first step 112 where the sensor obtains time information from its own internal clock. Following the step 112 is a step 114 where the sensor appends the time information to the outgoing data. Just as adding time information to incoming data, adding time information to outgoing data may be used to determine when and how to adjust the internal time.

Following the step 114 is a step 116 where the message/data is transmitted to the AP 32 using, for example, the transceiver 46. Following the step 116 is a test step 118 where it is determined if there is more of the message to send. Just as with information transmitted by the AP 32 to the sensor, information transmitted from the sensor to the AP 32 may be transmitted using variable length data packets where the length may be adjusted based on the quality of the wireless communication link between the sensor and the AP 32 so that it is possible for a particular message to span more than one data packet. If it is determined at the test step 118 that there is not more data to transmit, then processing is complete. Otherwise, control transfers from the test step 118 back to the step 112 to transmit the additional data.

In an embodiment herein, it is possible for the AP 32 to send explicit commands to one or more of the sensors 34-36 to cause a sensor to enter the sleep mode and/or to transition from one sleep mode to another (e.g., shallow sleep to deep sleep). The AP 32 may indicate to the sensor the type (mode) of sleep and possibly even the amount of time to sleep. It may be desirable to have a sensor that receives a sleep command go to sleep immediately, and thus not indicate to the AP 32 that the sleep command was properly received. Accordingly, the sleep command may be sent from the AP 32 a number of times to increase the likelihood that the sleep command was properly received.

FIG. 6 shows a flow chart 130 that illustrates steps performed by the AP 32 in connection with the AP 32 sending a sleep command to one or more of the sensors 34-36. In an embodiment herein, the AP 32 may be able to simultaneously address multiple ones of the sensors 34-36 with a single sleep command transmission. In other embodiments, all commands transmitted by the AP 32 may only be directed to a single one of the sensors 34-36.

Processing for the flow chart 130 begins at a step 132 where a counter, C, is initialized to one. Following the step 132 is a test step 134 where it is determined if C exceeds a predetermined value, CMAX, that represents a number of times that the AP 32 will transmit the sleep command. In an embodiment herein, CMAX may be set to five, although other appropriate values may be used. In some instances, CMAX may be set by empirically observing sensor behavior and determining an acceptable value that is expected to be properly received by the sensors 34-36 in some number (percentage) of attempts. In some cases, CMAX may vary according to the identity of the particular one of the sensors 34-36 to which the sleep command is being directed.

If it is determined at the test step 134 that C is greater than CMAX, then processing is complete. Otherwise, control passes from the step 134 to a step 136 where the AP 32 transmits the sleep command to one or more of the sensors 34-36. In an embodiment herein, the sleep command may include the desired mode of sleep (e.g., shallow or deep) and/or may include a desired time for sleeping. For example, if the AP 32 desires data from a particular one of the sensors 34-36 every X seconds, then the AP 32 may, after receiving data, direct the particular one of the sensors 34-36 to sleep for approximately X seconds (probably slightly less). In other instances, it is possible for the AP to send a specific time at which the sensor is to wake up based on the sensor's clock, which is synchronized with the AP's clock. Following the step 136 is a step 138 where the index variable, C, is incremented. Following the step 138, control transfers back to the test step 134 for another iteration.

FIG. 7 shows a flow chart 150 that illustrates steps performed by a sensor in connection with periodically waking up (leaving the sleep state). Processing begins at a first test step 152, where it is determined if it is time to perform a data collection. As discussed in more detail elsewhere herein, it is possible to schedule periodic data collections by the sensors 34-36 and/or a subset thereof. Accordingly, if it is determined at the test step 152 that it is time for data collection by the sensor, then control passes from the test step 152 to a step 154 where the data is collected. Of course, collecting the data at the step 154 depends on the type of sensor, the specific data requested/needed, etc.

Following the step 154, or following the step 152 if there is no sensor data collection scheduled, is a test step 156 where it is determined if there is any communication activity from the AP 32 directed at the sensor. As discussed elsewhere herein, the sensor remains awake for a predetermined amount of time waiting for communication from the AP 32. If it is determined at the step 156 that there is no communication activity from the AP 32 directed to the sensor, then control transfers from the step 156 to a test step 158 where it is determined if the sensor is currently in the shallow sleep mode. As discussed in more detail elsewhere herein, in some embodiments the sensors 34-36 may have two sleep modes: a shallow sleep mode where the sleep cycle time is relatively short and a deep sleep mode where the sleep cycle time is relatively long.

If it is determined at the test step 158 that the sensor is currently in a shallow sleep mode, then control transfers from the test step 158 to a step 162 where a no activity counter variable, NOACTCNT, is incremented. The NOACTCNT variable determines the number of successive cycles for which the sensor did not detect any communication from the AP 32 directed to the sensor. Following the step 162 is a test step 164 where it is determined if NOACTCNT exceeds a predetermined limit for the number of times a sensor in a shallow sleep mode can detect no activity before placing itself to deep sleep mode. In an embodiment herein, the limit used at the test step 164 corresponds to W seconds, but of course other values may be used. If it is determined at the step 164 that NOACTCNT is greater than the predetermined limit, then control transfers from the step 164 to a step 166 where the sensor places itself in a deep sleep mode.

Following the step 166 or the step 164 if NOACTCNT is not greater than the limit is a step 168 where the sensor sleeps. The amount of time that the sensor sleeps at the step 168 depends, at least in part, on whether the sensor is in a deep sleep mode or a shallow sleep mode (or possibly some other mode). Furthermore, in some embodiments, the AP 32 may direct the sensor to sleep for a specific amount of time and/or until a particular time (e.g., until it is time to collect more sensor data). Note that the step 168 is also reached from the step 158 if it is determined at the step 158 that the sensor is not in the shallow sleep mode. Following the step 168, control transfers back to the step 152, discussed above, for another iteration.

If it is determined at the step 156 that the AP 32 has sent a command/message to the sensor, then control transfers from the step 158 to a step 172 where the sensor is explicitly placed in the shallow sleep mode. Note that if the sensor is already in the shallow sleep mode, then the processing at the step 172 will not affect the state of the sensor but that if the sensor was in a deep sleep mode (or some other mode) prior to the step 172, then the processing at the step 172 changes the sleep mode of the sensor. Following the step 172 is a step 174 where the NOACTCNT variable is set to zero. Following the step 174 is a step 176 where the command/message from the AP 32 is received and processed, as described in more detail elsewhere herein. Following the step 176, control transfers to the step 168, discussed above, to cause the sensor to sleep.

In some instances, a sensor may receive the same command/message a number of times from the AP 32 because the AP 32 is not receiving the response (acknowledgement) from the sensor due to poor data link quality from the sensor to the AP 32. Similarly, the AP 32 may send the same command/message a number of times to a sensor before the command/message is properly received by the sensor due to poor data link quality from the AP 32 to the sensor. It is useful to be able to distinguish between the two different cases to determine whether to adjust the transmit power of the sensor, the transmit power of the AP, or both. Accordingly, in some instances each message/command provided by the AP 32 may be assigned a unique numeric identifier (e.g., serial number) so that a sensor can distinguish between different instances of commands/messages from the AP 32. In addition, a sensor may use the identifier to keep track of the number of times it sees each particular command/message. Note also that there may be other parameters that control packet delivery rates, such as the number of repeated retransmissions of commands or sensors responses. In some embodiments, if the AP 32 detects that most commands sent by the AP 32 are lost, the AP 32 may want to increase the number of retransmission instead of increasing transmit power. For different transceivers, the energy trade-offs may be different.

FIG. 8 shows a flow chart 200 that illustrates steps performed by a sensor in connection with providing information regarding communication data link quality between the sensor and the AP 32. Processing begins at a first test step 222 where the sensor determines if the command/message that has been received had been previously received. The test at the step 222 examines the identifier (serial no.) of the received command/message. As discussed elsewhere herein, the AP 32 assigns a unique identifier to each command/message. Thus, if the identifier of the received command/message is the same as that of a command/message already received, then it is the same command/message being resent by the AP 32.

If it is determined at the test step 222 that the identifier of the received message/command does not match that of one already received, then control transfers from the test step 222 to a step 224 where a retry count variable (RT) associated with the identifier is initialized to zero. Otherwise, if it is determined at the test step 222 that the identifier of the received message/command matches that of one already received, then control transfers from the test step 222 to a step 226 where RT is incremented. Following the step 224 or the step 226 is a test step 228 where it is determined if the message/command from the AP 32 is requesting data (as opposed to requesting that some action be performed, like changing the clock time). If it is determined at the test step 228 that the message/command from the AP 32 is for data, then control transfers from the test step 228 to a step 232 where the sensor sends the data to the AP 32 (along with the RT value and the timestamps, discussed above). In an embodiment herein, all requests for data by the AP 32 are serviced no matter how many identical prior requests had already been serviced. Following the step 232, processing is complete.

If it is determined at the test step 228 that the message/command from the AP 32 is not a request for data, then control transfers from the test step 28 to a test step 234 where it is determined if RT is zero (first instance of message/command from the AP 32). If it is determined at the test step 234 that RT is zero, then control transfers from the test step 234 to a step 236 where the action requested by the AP 32 (e.g., change internal clock time) is performed. Following the step 236 or following the step 234 if RT does not equal zero is a step 238 where the sensor sends an acknowledgement back to the AP 32. The acknowledgement may include the value of RT, the timestamps, etc. Following the step 238, processing is complete.

FIG. 9 is a schematic illustration showing a table 250 that is maintained by a sensor includes a plurality of entries 252-254 that correlate different identifiers with different RT variables. For example, the entry 252 indicates that ID1 has been received by the sensor RT1 times (or RT1 plus one times, depending upon whether RT is initialized to zero or one). The table 250 may be consulted in connection with performing processing illustrated by the flow chart 200, discussed above. In an embodiment herein, the table 250 may be implemented as a linked list, although other appropriate data structures may be used. Note also that, to preserve storage space in the memory 48, a sensor may discard the oldest entries in the table 250 as more space is needed for new entries. If the identifiers are numerically sequential, then the entries having the lowest numerical value may be the oldest.

FIG. 10 shows a flow chart 270 that illustrates steps performed by the AP 32 in connection with exchanging information with sensors and adjusting transmitting power on the AP 32 and/or a sensor. Processing begins at a first step 272 where a variable, COUNT, is set to one. The COUNT variable keeps track of how many times the AP 32 transmits the same message to the sensor. Following the step 272 is a step 274 where the message/command is sent by the AP 32. Following the step 274 is a step 276 where the AP 32 determines if the sensor has acknowledged the message/command (replied in some fashion). If not, then control transfers from the step 276 to a step 278 where the COUNT variable is incremented. Note that acknowledgement by a sensor may be explicit (acknowledge message sent) or implicit (e.g., AP 32 requests particular data and the sensor returns the requested data).

Following the step 278 is a test step 282 where it is determined if the value of the COUNT variable has exceeded some limit (i.e., has the number of attempted transmissions exceeded some limit). If so, then control transfers from the step 282 to a step 284 where appropriate error processing is performed (e.g., log error, report to user, etc.). Following the step 284, processing is complete. Note that, in some embodiments, it may be possible to increase transmission power of the AP 32 at the step 284 and then retry transmission by transferring control back to the step 272. Note also, however, that if the transmission problem is due to the sensor not using enough power to transmit back to the AP 32, then the problem will not be fixed by increasing the transmission power of the AP 32, but, instead, is fixed by having the sensor increasing its transmit power.

If it is determined at the step 276 that the sensor has acknowledged (implicitly or explicitly) the message/command from the AP 32, then control transfers from the step 276 to a test step 285 where it is determined if the value of the COUNT variable is less than a predetermined limit. Note that the limit used at the step 285 is not greater than the limit used at the step 282. The limit used at the step 285 determines if transmission between the AP 32 and the sensor occurs in a reasonable number of attempts. For example, one or two attempts would tend to indicate that the wireless link between the AP 32 and the sensor is good while a dozen attempts would tend to indicate otherwise. Of course, the limit at the step 285 may be set based on a variety of factors such as the desired retransmission rate, the desired throughput, available bandwidth, available transmission power at both the AP 32 and the sensor, etc.

If it is determined at the step 285 that the value of COUNT does not exceed the limit, then processing is complete. Otherwise, control transfers from the test step 285 to a test step 286 where the retry value returned by the sensor (RT) is examined. Note that if RT is relatively high (close to the value of COUNT), it means that most if not all of the transmissions from the AP 32 provided at the step 272 were received by the sensor and that the AP 32 did not receive most of the responses back from the sensor. Conversely, the value of RT being relatively low may indicate that most of the transmissions from the AP 32 to the sensor were not received by the sensor. Accordingly, the test at the step 286 compares the value of RT to a predetermined limit. If RT is less than the limit (relatively low), then control transfers from the test step 286 to a step 288 where the transmission power of the AP 32 is increased. Otherwise, control transfers from the test step 286 to a step 292 where the AP 32 sends a command to the sensor to cause the sensor to increase the transmission power thereof.

Note, by the way, that, in addition to the RT count returned by the sensor, it may be useful for the AP 32 to be provided with the amount of time that the sensor had been awake prior to providing a response. This way, transmissions by the AP 32 to the sensor while the sensor is sleeping will not be counted as bad transmissions. For example, if count is twelve and RT is one, the awake time value returned by the sensor may indicate that the sensor was sleeping during the first ten transmissions by the AP 32. This should be taken into account when determining data link quality. In an embodiment herein, the value of COUNT may be adjusted prior to the step 285 in order to compensate for transmissions by the AP 32 while the sensor was sleeping.

FIG. 11 shows a flow chart 300 that illustrates steps performed by a sensor in connection with receiving a command from the AP 32 to collect data at a particular time. Processing begins at a first step 302 where the sensor receives the command. Following the step 302 is a step 304 where the sensor sends an acknowledgement back to the AP 32. Note that receiving the data and sending an acknowledgement at the steps 302, 304 may be performed according to the processing illustrated by the flow chart 200. Following the step 304 is a step 306 where the sensor waits/sleeps until it is time to collect the data. In some embodiments, the sensor may always wait without sleeping. In other embodiments, the sensor puts itself to sleep for the necessary amount of time. In still other embodiments, the sensor may wait if the collection time is less than a predetermined amount of time in the future and put itself to sleep if the collection time is more than the predetermined amount of time in the future.

Following the step 306 is a step 308 where the sensor acquires the data. Following the step 308 is a step 312 where the sensor stores the data in its memory (for later transmission to the AP 32). Following the step 312, processing is complete. In an embodiment herein, the sensor retains collected data until the AP 32 directs the sensor to collect new data so that if there is any difficulty transmitting the data to the AP 32, the AP 32 can request retransmission. In some instances, the data may be retained only until the sensor receives an indication that all data has been received successfully by the AP 32. Such an indication may be included as a part of a sleep command from the AP 32, or there may be a dedicated command from the AP 32 allowing the sensor to power down part of its memory containing the data to save energy.

FIG. 12 shows a flow chart 320 that illustrates steps performed by the AP 32 in connection with obtaining collected data from a sensor. Processing begins at a first step 322 where the AP 32 determines the number of segments (separate packets) that comprise the data. As discussed elsewhere herein, data may be broken into segments and transmitted in separate packets. The determination at the step 322 may include dividing the (expected) total amount of data by the packet size. Following the step 322 is a step 324 where an index variable, C, is set to one. The index variable, C, may be used to iterate through the data packets.

Following the step 324 is a test step 326 where it is determined if the index variable, C, is greater than the number of segments (NSEG). If so, then processing is complete. Otherwise, control transfers from the step 326 to a step 328 where the AP 32 requests that the sensor transmit segment C. Following the step 328 is a test step 332 where it is determined if the AP 32 has successfully received the requested data. If not, then control loops back to the step 328 to request the data again. Note that the steps 328, 332 may be performed according to the processing illustrated by the flow chart 270. If it is determined at the step 332 that the AP 32 has successfully received the requested data, then control transfers from the test step 332 to a step 334 where the index variable, C, is incremented. Following the step 334, control transfers back to the step 326 for another iteration.

According to the system described herein, the sensor node electronics may be put into a low-energy sleep state between signal acquisitions in order to conserve battery. The circuitry being switched off may include the high-accuracy timers used by the sensor's microcontroller (e.g., processor 44 of sensor 34). The sleep-wake cycle may be monitored by a real-time clock external to the microcontroller, operating at resolution and accuracy not sufficient for vibration monitoring uses (i.e., at a resolution and/or accuracy less than that of the high-accuracy timers). For example, the real-time clock used for wake-up purposed may operate with 1 second accuracy, while the required clock synchronization accuracy may be below 1 ms range. Therefore, when a sensor node wakes up, it may be necessary to rapidly synchronize it to the rest of the system (i.e. the access point node needs to calculate the sensor node's relative clock offset) and that the synchronization be done “from scratch”—i.e., without using prior timing data. Also, it may be desirable that synchronization be done with as few message exchanges as possible, so that the energy use is minimized. For example, assume that the roundtrip time for timestamp message exchange is 40 ms. Then, exchanging 50 message pairs with 4 vibration sensors will take at least 8 s, assuming no packet losses. This means that a vibration sensor might spend almost as much time waiting to be synchronized as for the actual data acquisition. Reducing the number of timestamp exchanges may save energy and prolong battery life. Accordingly, as further discussed elsewhere herein, the system described herein provides for rapid synchronization of wireless devices that does not require the use of prior timing data.

FIG. 13 shows a timing diagram 400 according to an embodiment of the system described herein in connection with the AP 32, as a control node, broadcasting N reference messages to sensor nodes N1 and N2 (e.g., sensor nodes 34 and 35). The network of the AP 32 and sensor nodes N1 34 and N2 35 may operate in a star network configuration in which the messages are not exchanged directly between the nodes N1 34 and N2 35. Although the system described herein is discussed principally for two sensor nodes (N1 and N2) and one control node (AP), the system may be extended to more than two sensor nodes and/or more than one control node as appropriate in accordance with desired implementations and performance characteristics. The number N of reference messages may be chosen according to desired operational characteristics and as further discussed elsewhere herein. The messages may be generated by a microcontroller (e.g., processor 62) of the AP 32 at times t₁ ^((i)) (for i=1 . . . N) and leave a transceiver of the AP 32 at times t₂ ^((i)). The messages reach the transceivers of N1 34 and N2 35 at times t₃₁ ^((i)) and t₃₂ ^((i)), and are handed over to microcontrollers of the nodes N1 34 and N2 35 at times t₄₁ ^((i)) and t₄₂ ^((i)), respectively.

Following receipt of a broadcast message, both N1 34 and N2 35 may record the respective times of receipt according to their local clocks, L₁(t₄₁ ^((i))) and L₂(t₄₂ ^((i))) (where L_((i))(t) denotes a respective clock reading at a time t), but may refrain from any further actions, including sending any messages to other nodes. Instead, both N1 34 and N2 35 may wait for another reference broadcast or wait for another command from the AP 32. After transmitting N reference broadcast messages, the AP 32 sends to each sensor node a request for timestamp data. The order in which these timestamp requests are sent to particular sensors may be interchangeable without affecting operation of the system. For example, in the diagram 400, first a request is sent to N2 35 and then to N1 34, but a reverse sequence may also be used. It is noted, however, that that the requests may be sent separately so that responses may be sent immediately without risk of a collision. Having received a request, N1 34 and N2 35 send a single message to the AP 32 containing all record timestamps L₁(t₄₁ ^((i))) and L₂(t₄₂ ^((i))).

After receiving the response from N1 34 and N2 35, the AP 32 is in possession of all timing information and may calculate relative clock offsets between the sensor node clocks. Specifically, after sufficiently many timestamp pairs L₁(t₄₁ ^((i))) and L₂(t₄₂ ^((i))) are received from N1 and N2, the AP 32 may calculate a collection of individual clock offset estimates

O^((i)) ₁₂=L₁(t₄₁ ^((i)))−L₂(t₄₂ ^((i))). Then, the set of individual estimates O^((i)) ₁₂ may be used to calculate the overall clock offset estimate. This may be done using any of a number of well-known methods, including arithmetic mean, median, or their trimmed versions (with outliers rejected).

After the AP 32 has calculated the relative clock offsets between the two sensor nodes 34, 35, the AP 32 may send resulting information back to N1 34 and N2 35, possibly within another broadcast message. Then, both sensor nodes may use the resulting offset calculation information to convert any time information in future commands from the AP 32. Alternatively, and/or additionally, an advantageous solution may be to keep the offset information within the AP 32 since the AP 32 may have a higher computational capability than the sensor nodes and may have an unconstrained power supply. Therefore, the AP 32 may be more suitable to perform a majority of the calculations and computations may then be minimized at the sensor nodes 34, 35. The AP 32 may use the estimated relative clock offsets to appropriately adjust the clock values to be included in commands sent to the sensor nodes 34, 35, so that the actions of the sensor nodes 34, 35 correspond to the same physical time instances. For example, when the AP 32 needs N1 34 and N2 35 to acquire sensor data, the AP 32 may command N1 34 and N2 35 to start data acquisition at times t_(a1) and t_(a2), respectively, with t_(a1) and t_(a2) given according to the sensor nodes' local clocks, and chosen so that t_(a1)−t_(a2)=O₁₂, where O₁₂ is the estimate of the relative offset between those clocks. This way, neither of the sensor nodes 34, 35 needs to be concerned with the issue of how the clock offset estimate is calculated or updated. All that the sensor nodes 34, 35 need to know is the time instants, according to their local clocks, when they are required to perform their actions, such as data acquisition, control signal updates, etc. An advantage of this approach is that the software running on sensor nodes is simplified and resource use is minimized. This may be particularly beneficial if dynamic tracking of clock offset drift is also needed, which may require significant computational effort and which is further discussed elsewhere herein.

In a practical situation it may happen that some of the messages may be lost. To accommodate possible losses of reference broadcast messages from the AP 32 to the sensor nodes 34, 35, each broadcast message may include an identifier (e.g. a serial number) so that when N1 34 and N2 35 send back the timestamp results, each timestamp value may be accompanied by the identifier of the corresponding reference broadcast. Then, the AP 32 may easily match the timestamp pairs coming from N1 34 and N2 35 and determine if an additional round of reference broadcasts may be needed for sufficiently accurate clock offset estimation.

FIG. 14 shows a timing diagram 450 that illustrates an algorithm variant in which an additional round of reference broadcasts is used in case of unexpected message losses. Suppose that after sending N reference broadcast messages, the AP 32 receives M₁ timestamp values from N1 34 and M₂ timestamp values from N2, and establishes that M timestamp pairs may be used for clock offset estimation. Typically, M will be smaller than either M₁ or M₂, because not the same broadcast messages may be lost on the AP−N₁ and AP−N₂ propagation paths. If the AP 32 determines that M is too small a number for accurate estimation of the relative clock offset between N1 and N2, then a second round of synchronization may follow, with K additional broadcast messages sent to both sensors. The AP may choose the number K in such a way that K>N−M, to make sure that at least N valid timestamp pairs are received from both sensor nodes. To determine the proper value of K, the AP may estimate the message loss rate as (N−M)/N and choose the number K such that K>(N−M)*N/M. Other approaches to determine the number K are also possible.

It may be noted that if fewer than desired timestamp pairs arrive from N1 and N2 in the second round, additional rounds may be needed. To prevent the need for such iterations, the original number N of broadcast messages may be chosen in such a way that even with the expected message loss rate the AP 32 will receive sufficiently many timestamp pairs. On the other hand, when message loss rate is variable in time, it may not be always necessary to send too many reference broadcasts, as this may lead to unnecessary energy use. In such cases, it may be preferred to adjust the number of broadcast messages as needed according to the currently observed message loss rate, starting with the nominal number N.

The variant with multiple synchronization rounds may also be advantageous if variation between the individual clock offset estimates O^((i)) ₁₂=L₁(t₄₁ ^((i)))−L₂(t₄₂ ^((i))) is unpredictable or changing throughout the system's operation. Then, the required number of samples necessary for an accurate estimate may not be a priori known, and may require on-line adjustments. Then, the initial number N may be chosen based on the nominal expected variation of O^((i)) ₁₂, and then additional K broadcast messages may be sent to reach the desired accuracy. Known techniques for selection of an appropriate sample size depending on the observed sample variance may be used. Further, message losses affecting timestamp requests and timestamp responses may be addressed using known retransmission approaches.

In situations where synchronization accuracy is required, it may be necessary to estimate the relative clock drift, i.e. to model the relative clock offset as a function of time. This may be particularly useful if the clock offset information is used to schedule actions, such as data acquisition, that may be removed in time with respect to the synchronization process. In an embodiment, linear dependence on time may be assumed, and the clock drift rate may be estimated in addition to the instantaneous clock offset using known clock drift estimating techniques based on a number of individual clock offset observations. For example, a typical 100 ppm clock drift rate over 2 s time interval would give a 0.2 ms synchronization error without using the correction techniques described herein. It is noted that the system described herein may also be used and operate in connection with non-linear dependence of clock drift over time. It is further noted that the clock drift does not need to be expressed as a function of the AP 32's own time, but may be referenced to the local clock of either N1 34 or N2 35. This way, the message processing time jitter at the AP 32 may not influence the drift estimation accuracy.

Accurate drift rate estimation may require a larger collection of timestamp pairs than offset estimation alone. On the other hand, the AP 32 may use previous drift rate estimates from previous synchronization cycles. Differences in clock rates between N1 34 and N2 35 may be approximately constant, or very slowly varying, between consecutive sensor wake-ups, even if both clocks may be reset at random time instances. So at the next synchronization round, the AP 32 may reuse the previous drift rate estimate and update only the clock offset estimate. Alternatively, a long-term tracking algorithm, such as Kalman filter, may be used to track slow changes of the drift rate, using both the previous information and the new data from the most recent synchronization cycle.

The AP 32 may initiate a synchronization cycle according to the system described herein whenever the AP 32 predicts that N2 35 will be required to perform a synchronous action (such as data acquisition) with N1 34 (or vice versa). To start the process, the AP 32 may first establish that N1 34 and N2 35 are both awake. This may be based on the current time, assuming that the AP 32 knows the sleep-wake schedule of N1 34 and N2 35, with the AP 32 controlling or at least monitoring most of sensor nodes' activities. Note that if the system is intended for synchronous data acquisition, then it may be desirable to have N1 34 and N2 35 scheduled to wake around the same time to make synchronization possible. Additional time margin may be added after the predicted wake up times of N1 34 and N2 35, to account for possible inaccuracies of wake up timers, random delays in wake-up process etc. Alternatively, the AP 32 may periodically poll N1 34 and N2 35, requesting their status, and when responses have arrived indicating that N1 34 and N2 35 are active, then the synchronization process may be started. A combination of both approaches may be also used, with the AP 32 starting to poll N1 34 and N2 35 for status only after N1 34 and N2 35 are close to their expected wake-up moments. In the case when no synchronous action will be required from N1 34 and N2 35, there may be no need for rapid resynchronization, and the AP 32 may command N1 34 and N2 35 to enter a sleep state. Otherwise, the AP 32 may start the synchronization cycle after establishing that both N1 34 and N2 35 are active.

It should be noted that consecutive reference broadcast messages sent by the AP 32 may need to be spaced appropriately to make sure that each of the sensor nodes 34, 35 has no other tasks to perform when a reference message arrives. In this way, errors corresponding to random processing delays on each sensor node may be minimized. When a reference message is handed over by the transceiver 46 to the sensor node's processor 44, it may be desirable that the processor 44 applies the timestamp as soon as possible (see FIGS. 2A and 4). This may require that processing of any previous reference messages has been completed. For this reason, the AP 32 may implement a sufficiently long waiting period between the consecutive broadcast messages. On the other hand, this delay should be as short as practical to limit the overall duration of the synchronization procedure in order to minimize the energy use. Reasonable upper bounds for one-way transmission time may be estimated.

FIGS. 15A and 15B show a flow diagram 470 for an algorithm according to an embodiment of the system described herein for achieving synchronization using the broadcasting of reference messages from the AP 32. The number of reference messages (e.g., N messages) broadcast may be determined as further discussed elsewhere herein. At a step 472, a first set of multiple reference messages are sent from the AP 32 to each of the plurality of wireless sensors N1 34, N2 35. After the step 472, processing proceeds to a step 474, where, at each of the wireless sensors 34, 35, a timestamp is recorded corresponding to each of the reference messages that is received. After the step 474, processing proceeds to a step 476 where the AP 32 sends a request to the first sensor N1 34 requesting the timestamps corresponding to the broadcast reference messages received by the first sensor N1 34 (M₁ timestamps). After the step 476, processing proceeds to a step 478 where the first sensor N1 34, in response to the request from the AP 32, sends a response to the AP 32 that includes the timestamps corresponding to the reference messages received by the sensor N1 34.

After the step 478, processing proceeds to a step 480 where the AP 32 sends a request to the second sensor N2 35 requesting the timestamps corresponding to the broadcast reference messages received by the second sensor N2 35. After the step 480, processing proceeds to a step 482 where the second sensor N2 35, in response to the request from the AP 32, sends a response to the AP 32 that includes the timestamps corresponding to the reference messages received by the sensor N2 35 (M₂ timestamps).

After the step 482, processing proceeds to a test step 484 where the AP 32 determines whether a sufficient number of timestamp pairs (M₁ and M₂) have been received from the sensors N1 34, N2 35. As further discussed elsewhere herein, an insufficient number of timestamp pairs may result from loss of reference messages. If sufficient timestamp pairs have been received by the AP 32, then processing proceeds to a step 486 where the AP 32 determines the relative clock offsets between each of the sensors N1 34, N2 35 using the timestamp pairs (M₁ and M₂). It is noted that although two sensors are discussed above with respect to above-noted algorithm, the algorithm may be extended to more than two sensors. After the step 486, processing is complete.

If at the test step 484, it is determined that sufficient timestamp pairs have not been received, then processing proceeds to a step 488 where an additional set of reference broadcast messages may be sent by the AP 32 to each of the sensors N1 34, N2, 35. The number of additional reference messages (e.g., K messages) broadcast may be determined as further discussed elsewhere herein. After the step 488, processing proceeds to a step 490, where, at each of the N1 34, N2 35, a timestamp is recorded corresponding to each of the additional reference messages that is received. After the step 490, processing proceeds to a step 492 where the AP 32 sends a request to the first sensor N1 34 requesting the timestamps corresponding to the additional broadcast reference messages received by the first sensor N 34. After the step 492, processing proceeds to a step 494 where the first sensor N1 34, in response to the request from the AP 32, sends a response to the AP 32 that includes the timestamps corresponding to the additional reference messages received by the sensor N1 34.

After the step 494, processing proceeds to a step 496 where the AP 32 sends a request to the second sensor N2 35 requesting the timestamps corresponding to the additional broadcast reference messages received by the second sensor N2 35. After the step 496, processing proceeds to a step 498 where the second sensor N2 35, in response to the request from the AP 32, sends a response to the AP 32 that includes the timestamps corresponding to the additional reference messages received by the sensor N2 35. After the step 498, processing proceeds back to the test step 484.

An advantage of the above-noted embodiment is that synchronization between the AP 32 and the sensor nodes 34, 35 may be avoided. Nevertheless, in practical operation of a sensing system according to that described herein, the AP 32 may perform a rough estimation of the offset of the sensor nodes 34, 35 relative to the AP 32's own clock. For example, when the AP 32 is about to request data acquisition from a number of sensors, it may be desirable that not only does the AP 32 make sure that the starting clock values sent to all sensors correspond to the same physical time instant, but further that the AP 32 make sure that the requested time lies indeed in future, but not too far in future, to avoid excessive waiting. The AP 32 may also have an approximate idea when the sensor nodes 34, 35 will complete their data collection so that the AP 32 can request transmission of the acquired data (an alternative approach of having sensors announce completion of data collection themselves may potentially lead to possible message collisions). For these reasons, the AP 32 may estimate the clock offsets O₀₁ and O₀₂ between the AP 32's own clock and those of N1 34 and N2 35. Fortunately, accuracy of this estimation need not be as good as that for the relative clock offset O₁₂, particularly if all sensors in the system are wireless and synchronized as described herein.

According to an embodiment of the system described herein, sensor-to-AP offset estimation may be performed by calculating a number of individual estimates O^((i)) ₀₁=L₀(t₁ ^((i)))−L₂(t₄₂ ^((i))) and O^((i)) ₀₂=L₀(t₁ ^((i)))−L₂(t₄₂ ^((i))) based on the recorded transmission timestamps t₁ ^((i)) and the receipt timestamps t₄₁ ^((i)) and t₄₂ ^((i)) received from the sensor nodes 34, 35. Then, these individual estimates may be used to calculate the overall offset estimate, through trimmed or untrimmed mean or median, as described elsewhere herein. Such simplified calculation will not be precisely accurate, as it ignores effects of the propagation and processing delays t₄₁ ^((i))−t₁ ^((i)), and effectively assumes that the three time instances are equal, i.e. t₄₂ ^((i))=t₄₁ ^((i))=t₁ ^((i)). On the other hand, the resulting error may be easily bounded from above, particularly if outlier rejection is used to eliminate unusually long processing times. Then, the AP 32 may add an additional safety margin to the resulting offset estimates to make sure that the scheduled sensor node actions lie always in future, or that all sensors have finished their data collection before data requests are sent.

An alternative solution for the concurrent sensor-to-AP clock offset estimation is to use the timestamp requests and responses in a quadruple timestamp-based receiver-sender synchronization approach, as described elsewhere herein. In this approach, the AP 32 and the appropriate sensor node may attach an additional four timestamps to each request-receive message pair after each reference broadcast message round. As discussed elsewhere herein, accuracy of such estimation based only on one or two timestamp exchanges may be worse than the sensor-to-sensor broadcast-based synchronization. However, it may be sufficient in practice if additional appropriate safety margins are used in calculation of future event times.

The system described herein may also operate to address issues involving packet propagation delays. It is noted that the following discussion is explained principally in connection with an AP and one sensor node (N1); however, the embodiment may be extended to more than one sensor node (e.g., N1, N2 etc.) and more than one AP according to desired operation of a system.

FIG. 16 is a timing diagram 500 showing timestamping of messages exchanged between two devices (the AP 32 and the sensor node N2 35) in connection with an embodiment of the system described herein to address issues of accurate synchronization between the AP 32 and individual sensors. When the AP 32 sends a message to the N2 35 at time instant t₁, the AP 32 reads its own internal clock, and attaches the reading L₁(t₁) to the message payload. If there were no propagation delays, then, upon receiving the message, N2 could adjust its clock to the value L₁(t₁). However, by the time N2 35 receives the message, the AP 32 clock no longer reads L₁(t₁). The delay in time between the sending and receiving a message includes time for processing the data packet the transmitter, actually transmitting it through radio waves, and then processing it at the receiver. Data processing may additionally include time for communication between the wireless transceiver component and the microcontroller component of the sensing device. The propagation delay may also include time for possible retransmissions in case of packet losses. Those delays are a priori unknown. To estimate and eliminate the effects of these delays, both nodes exchange messages that are time-stamped at sending as well as at reception.

In the first step of the two-message exchange, the AP 32 attaches an outgoing timestamp L₁(t₁) to the message that is about to be sent to N2 35. Then, N2 35 applies its incoming timestamp L₂(t₄) to the received message, according to N2 35 clock. Note that the timestamp difference L₂(t₄)−L₁(t₁) includes a true (absolute) elapsed transmission time t₄−t₁ and the offset between the two clocks. These two timestamp values are retained and then attached to the next message from N2 35 to the AP 32, whenever it is going to be sent. When this happens, N2 35 will also attach the outgoing timestamp L₂(t₅). Thus, the message from N2 35 to the AP 32 will contain in its payload, in addition to any other information, the timestamp L₂(t₅) corresponding to the current message, and two timestamps L₁(t₁) and L₂(t₄) corresponding to the most recent message from the AP 32 to the N2 35. Finally, when the message is received by the AP 32, the fourth timestamp L₁(t₈) is recorded. Thus, upon receipt of the response from N2 35, the AP 32 is in possession of four timestamp values: L₁(t₁), L₂(t₄), L₂(t₅) and L₁(t₈). These four values may allow an estimation of the instantaneous offset between the two clocks, e.g., according to the formula:

O ^((i))=(L ₁(t ₈ ^((i))) +L ₁(t _(1(i)))−L ₂(t ₄ ^((i)))−L ₂(t ₅ ^((i))))/2.

However, the above simple estimation assumes that the physical radio packet propagation times in both ways are the same, and that transmission delays, reception delays and processing delays are similar at both nodes. Furthermore, a simple estimation assumes that the rates of both clocks are close and the instantaneous offset between the two clocks does not change appreciably throughout the two message exchange. However, in practice, significant estimation errors may be caused by delay times not being uniform and varying randomly and/or may be caused by other delay factors (particularly using certain off-the-shelf wireless cards), and therefore require large numbers of time-stamped messages to attempt to provide more accurate estimations. Additionally, correlation of consecutive clock offset estimates containing errors may also produce substantial errors in resulting clock offset estimates. Accordingly, the system described herein provides techniques to address the above-noted issues of clock offset estimate errors including de-correlating the consecutive offset estimates.

As discussed elsewhere herein, the AP 32 may initiate a synchronization cycle whenever the AP 32 predicts that N2 35 will be required to perform a synchronous action (such as data acquisition) and the AP 32 needs first to establish that N2 35 is awake. In the case when no synchronous action will be required from N2 35, there may be no need for rapid re-synchronization, and the AP 32 may command N2 35 to enter a sleep state. Otherwise, the AP 32 may start the synchronization cycle after it has established that N2 35 is active.

FIG. 17 is a flow diagram 550 showing an algorithm according to the system described herein that may be executed by the AP 32 in connection with estimating relative offsets. At a step 552, for index variable i=1 . . . N, set i=1. After step 552, processing proceeds to a step 554 where the i-th time instant t₁ ^((i)) is selected for the next transmission according to at least one timing variants, like that which is further described elsewhere herein. After the step 554, processing proceeds to a step 556 where, at time t₁ ^((i),) a synchronization message with timestamp L₁(t₁ ^((i))) is sent. After the step 556, processing proceeds to a step 558 where a synchronization response is received from N2 35 that carries timestamps L₁(t₁ ^((i))), L₂(t₄ ^((i))), L₂(t₅ ^((i))), and the received timestamp L₁(t₈ ^((i))) is noted. After the step 558, processing proceeds to a test step 560 where it is determined if i=N. If i does not equal N, then processing proceeds to a step 562 where i is incremented (i=i+1). After the step 562, processing proceeds back to the step 554. If i is determined to equal N at the test step 560, then processing proceeds to a step 564 at which the collection of timestamp sets L₁(t₁ ^((i)), L₂(t₄ ^((i))), L₂(t₅ ^((i))), L₁(t₈ ^((i))), i=1 . . . N, is used to estimate the relative clock offset, as further described below. After the step 564, processing is complete.

The simplified algorithm shown assumes that a synchronization response from N2 35 always arrives. In case of packet losses, a suitable timeout may be implemented at the AP 32, after which the next synchronization message will be sent by the AP 32 to N2 35 even if no response has been received. In an embodiment, to make sure that a suitably large timestamp set is acquired, the loop condition may be tied not to the number of messages sent, but to the number of responses received. Alternatively and/or additionally, to avoid an infinite loop in case of a complete communication breakdown, a maximum number of transmissions may be specified to break the loop even if fewer than N responses were received.

The desired number of message pairs N may be pre-specified based on the required synchronization accuracy and on the predicted probability distribution of transmission times. Alternatively, N may be continually adjusted based on the actually observed variability of instantaneous clock offset estimates. The number of samples to achieve prescribed accuracy may be determined according to standard statistical techniques.

In an embodiment, the system described herein provides for selection of transmission times according to a random distribution. The system described herein addresses and alleviates the problem of possible bias in clock offset estimates due to accidental correlation of transmission times t₁ or t₅ to either transceiver's Δ cycle, where the times at which a wireless transceiver hands off received messages to a sensor's processor or to the AP's processor are quantized with a step Δ, which may be known, although the relative shifts of Δ cycles between the AP 32 and the sensors' transceivers may be a priori unknown. The system described herein provides that, among a finite (and small) set of N message pair exchanges, the average transmission delays t₄−t₁ and t₈−t₅ are close to their statistically expected values. This may be achieved by choosing the send time instances randomly, in such a way that correlation with the Δ cycle is avoided.

FIG. 18 shows a timing diagram 600 for randomized transmission time instants according to an embodiment of the system described herein. According to the system described herein, if send times are randomly distributed in a uniform manner relative to boundaries of Δ intervals, then the resulting transmission delays will be distributed among their expected values. This can be done by delaying the transmit time by a random value distributed uniformly between 0 and Δ.

FIG. 19 is a flow diagram 650 showing a timing algorithm for randomized transmission time instances performed on the AP 32 side according to an embodiment of the system described herein. At a step 652, an integer K is chosen such that KΔ is greater than the expected worst-case maximum round trip time t₈−t₁. After the step 652, processing proceeds to a step 654 where the starting time T_(s) is set. After the step 654, processing proceeds to a step 656 where a counter, COUNT, is set to 1. After the step 656, processing proceeds to a step 658 where a random delay δ is generated according to a uniform distribution between 0 and Δ. After the step 658, processing proceeds to a step 660 where the AP 32 waits until its internal clock reaches T_(s)+δ. After the step 660, processing proceeds to a step 662 where, at time T_(s)+δ, a synchronization message is sent to N2 35 with a timestamp L₁(t₁) equal to T_(s)+δ. After the step 662, processing proceeds to a step 664 where T_(s) is set equal to T_(s)+KΔ. After the step 664, processing proceeds to a test step 666 where it is determined if COUNT equals N (the algorithm having been performed N times for N being an integer value that is determined as further discussed elsewhere herein). If COUNT does not equal N, then processing proceeds to a step 668 where COUNT is incremented by 1. After the step 668, processing proceeds back to the step 658. Otherwise, if it is determined that COUNT does equal N at the test step 666, then processing is complete.

It should be noted that while waiting until the next transmission, the AP 32 may, of course, be performing any other necessary tasks, including receiving and time-stamping a response message from N2 35. The reason to wait for at least KΔ time units between sending two consecutive messages is to make sure that the AP 32 has already received and processed N2's response. The intention is to avoid a situation when the AP 32 is trying to apply two timestamps at the same time. Accuracy of the synchronization procedure relies in part on reducing as much as possible the random elements of processing delays t₂−t₁ and t₈−t₇. For this reason, the AP 32 may not have any other tasks to perform when timestamps L₁(t₁) and L₁(t₈) are being applied. If a reply from N2 35 arrived to the AP 32 at the same time when the AP 32 is sending a new message to N2 35, then at least one of the two timestamps may carry an additional error. Waiting at least KΔ time units allows avoiding such a situation.

On the side of the responding node N2 35, the timing algorithm may be slightly more complicated. If the AP 32 uses the approach outlined above, then the time intervals between arrivals of consecutive synchronization messages at N2 35 would be between (K−1)Δ and (K+1)Δ. Now, if N2 35 tried to use a fixed delay offset greater than (K+1)Δ, this would invalidate the assumption, used by the AP 32, that the round trip time for a pair of messages is less than KΔ. A solution to this difficulty is to apply the random delay to the moving boundary that is incremented by Δ as needed.

FIG. 20 is a flow diagram 670 showing a timing algorithm for randomized transmission time instances on the sensor node N2 35 side according to an embodiment of the system described herein. At a step 672, an initial response time T_(r) is set. After the step 672, processing proceeds to a step 674 where a random delay δ is generated according to a uniform distribution between 0 and Δ. After the step 674, processing proceeds to a step 676 where the sensor node N2 35 waits until time instant T_(r). After the step 676, processing proceeds to a test step 678 where the sensor node N2 35 checks if a new synchronization message has arrived from the AP 32. If a new synchronization message has arrived, then processing proceeds to a step 680 where the sensor node N2 35 waits until time instant T_(r)+δ. After the step 680, processing proceeds to a step 682 where, at time instant T_(r)+δ, the sensor node N2 35 sends a synchronization response with timestamp L₂(t₅) equal to T_(r)+δ. After the step 682, processing proceeds to a step 684 where T, is set equal to T_(r)+Δ. After the step 684, processing proceeds back to the step 676. If at the test step 678 it is determined that a new synchronization message has not arrived from the AP 32, then processing proceeds directly to the step 684.

In an embodiment, some safeguards may be added to the algorithm shown in the flow diagram 670. For example, if the random delay δ is large and close to Δ, so that the next transmit time Tr+δ is close to T_(r)+Δ then by the time synchronization message is sent the clock value may be larger than the next boundary time. In such a case, the new T_(r) may be set to T_(r)=T_(r)+2Δ instead. Alternatively, after sending a synchronization response there may be an additional incrementation of the boundary time T_(r) by Δ (for this to work, K should be greater than 2).

It should be noted that in the above algorithm N2 35 may be in an infinite loop waiting for messages from the AP 32. In practice, this loop might be broken when the node has already received N synchronization messages. However, this might pose problems if some messages are lost. If data losses occur on the AP-to-N2 path, and the AP 32 may decide not to retransmit, then N2 35 may be waiting for synchronization messages that will never arrive. On the other hand, if the data loss happens on the N2-to-AP path, and the AP 32 retransmits synchronization packets because of lost responses, then N2 35 might not be ready for additional retransmitted synchronization messages. This difficulty may be solved for example by requiring that the AP 32 send a specific ‘end-of-synchronization’ message at the end of a cycle for N2 35 to break the waiting loop. Similarly, any non-synchronization message, such as data acquisition command, status request, or sleep command, may also be used to bring N2 35 out of the waiting loop.

It may be noted that for random selection of transmission times, in any particular synchronization cycle, the actual times may all be significantly larger or smaller than the expected value. After sufficiently many repetitions, such combinations may become likely. A way to avoid this is to choose N sufficiently large, so that significant deviations from uniform sample distribution are unlikely. If energy saving considerations dictate using small sample sizes N, then an alternative solution may be to distribute transmission times according to a deterministic scheme. Accordingly, another embodiment of the system described herein may provide for selection of uniformly space message transmission times.

FIG. 21 is a timing diagram 700 schematically showing selection of uniformly spaced message transmission times according to an embodiment of the system described herein. The main idea of this timing algorithm variant is to make sure that consecutive transmission time instances are shifted with respect to boundaries of the Δ intervals by increasing fractions of Δ. The diagram below illustrates this idea for the case when intervals between consecutive transmissions increase by Δ/4. Note that the node's processor does not know when the actual Δ cycle boundaries occur, because it does not have access to the transceiver's internal state. Nevertheless, by shifting transmission delays by a fraction of Δ, it may be assured that the actual transmission times will include values both below and above the expected value. By using a smaller fraction of Δ a more uniform sample distribution may be obtained. In particular, Δ/N may be used, so that N different intervals between consecutive messages are used. If M<N is used to generate fractions of Δ, then it may be advantageous to use M such that it divides N, so that all fractions occur the same number of times.

FIG. 22 is a flow diagram 720 showing a timing algorithm for uniformly spaced transmission times performed on the AP 32 side according to an embodiment of the system described herein. At a step 722, an integer K is chosen such that KΔ is greater than the expected worst-case maximum round trip time t₈−t₁. After the step 722, processing proceeds to a step 724 where a variable M is set for M<=N such that N is a multiple of M (or N=M). After the step 724, processing proceeds to a step 726 where the starting time T_(s) is set. After the step 726, processing proceeds to a step 728 where a fraction counter j is set to 1. After the step 728, processing proceeds to a 730 where a counter, COUNT, is set to 1. After the step 730, processing proceeds to a step 732 where the AP 32 waits until time instant T_(s)+jΔ/N. After the step 732, processing proceeds to a step 734 where the AP 32 sends a synchronization message with timestamp L₁(t₁) equal to T_(s)+jΔ/N. After the step 734, processing proceeds to a step 736 where fraction counter j is incremented (j=j+1). After the step 736, processing proceeds to a test step 738 where it is determined if j>=M. If so, then processing proceeds to a step 740 where j is set equal to 1. After the step 740, or after the test step 738 if j is not >=M, then processing proceeds to a step 742 where T_(s) is set equal to T_(s)+KΔ. After the step 742, processing proceeds to a test step 744 where it is determined if COUNT equals N (the algorithm having been performed N times for N being an integer value that is determined as further discussed elsewhere herein). If COUNT does not equal N, then processing proceeds to a step 746 where COUNT is incremented by 1. After the step 746, processing proceeds back to the step 732. Otherwise, if it is determined that COUNT does equal N at the test step 746, then processing is complete.

The algorithm of the flow diagram 720 does not take into account packet losses. Accordingly, in another embodiment, it may be provided that if some responses do not arrive from N2 35, the AP 32 may chose to use the previous fraction of Δ to delay the next transmission. That is, at time T_(s) the algorithm may check if a response arrived and restore the previous value of j. Alternatively, the fraction counter j may be increased only when a synchronization response arrives from N2 35. In both cases, the loop may count the number of responses instead of number of transmissions. As mentioned elsewhere herein, a maximum number of transmissions may be specified to break the loop when communication is lost, so that an infinite loop may be prevented.

FIG. 23 is a flow diagram 750 showing a timing algorithm for uniformly distributed transmission times on the sensor node N2 35 side according to an embodiment of the system described herein. The algorithm shown in flow diagram 750 may be similar to the flow diagram 720 for random response time instances but, instead of using KΔ as the delay, a timing boundary is shifted after every Δ interval. At a step 752, an initial response time T_(r) is set. After the step 752, processing proceeds to a step 754 where M is set the same as on the AP 32. After the step 754, processing proceeds to a step 756 where fraction counter j is set equal to 1. After the step 756, processing proceeds to a step 758 where the sensor node N2 35 waits until time instant T_(r). After the step 758, processing proceeds to a test step 760 where the sensor node N2 35 checks if a new synchronization message has arrived from the AP 32. If a new synchronization message has arrived, then processing proceeds to a step 762 where the sensor node N2 35 waits until time instant T_(r)+jΔ/N. After the step 762, processing proceeds to a step 764 where, at time instant T_(r)+jΔ/N, the sensor node N2 35 sends a synchronization response with timestamp L₂(t₅) equal to T_(r)+jΔ/N. After the step 764, processing proceeds to a step 766 where fraction counter j is incremented (j=j+1). After the step 766, processing proceeds to a test step 768 where it is determined if j>=M. If so, then processing proceeds to a step 770 where j is set equal to 1. After the step 770, or after the test step 768 if j is not >=M, then processing proceeds to a step 772 where T_(r) is set equal to T_(r)+Δ. After the step 772, processing proceeds back to the step 756. If at the test step 760 it is determined that a new synchronization message has not arrived from the AP 32, then processing proceeds directly to the step 772.

As further discussed elsewhere herein, a simple approach to estimate clock offsets is to treat each timestamp quadruple independently and calculate a set of N offset estimates according to the formula O^((i))=(L₁(t₈ ^((i)))+L₁(t_(1(i)))−L₂(t₄ ^((i))−L₂(t₅ ^((i))))/2. The set of individual estimates may then be used to calculate the resulting time offset estimate using, for example, arithmetic mean, median and/or their trimmed versions (with outliers rejected). It is noted, however, the with this approach the above-the-average and below-the-average values of transmission times t₄−t₁ and t₈−t₅ may not align on AP-N2 and N2-AP paths. Also, the Δ cycles on the AP 32 and N2 35 may not align. As a result, the collection of estimates O^((i)) may have unnecessarily large variation which would require the use of a larger sample size N.

A modification of this approach is to use the estimate O^((i)) for which the overall trip time L₁(t₈ ^((i)))−L₁(t₁ ^((i))) is the shortest, as it should correspond to a smallest uncertainty in processing time (random delays should be smallest). However, this modification may not be particularly suitable for embodiments of the system described herein in which the delay on the node N2 35 may include components introduced by the timing algorithm used and which have nothing to do with processing delays on the AP 32 or N2 35. If, however, it is assumed that clock drift is negligible on both the AP 32 and the node N2 35 and the clock offset is approximately constant throughout the synchronization procedure, then transmission delays in both directions may be treated independently, and the shortest time from the AP 32 to the node N2 35 may be combined with the shortest time from the node N2 35 to the AP 32. This way, the best case shortest roundtrip from the AP 32 to the node N2 35 and then back to the AP 32 may be artificially synthesized from two one-way best cases.

According to an embodiment of the system described herein, the clock offset may be determined by first calculating a set of one-way trip delays:

D ₁₂ ^((i)) =L ₂(t ₄ ^((i)))−L ₁(t ₁ ^((i)))and D ₂₁ ^((i))=(L ₁(t ₈ ^((i)))−L ₂(t ₅ ^((i))).

It may be noted that because of the a priori unknown offset between the two clocks, these delays are biased. But, because the clock offset may be assumed as constant, the biased delays may still be used to select the minimal values and the offset estimate (Ô) then calculated as:

Ô=(minD ₂₁ ^((i))−minD ₁₂ ^((i)))/2

According to another embodiment, another possibility is to sort the one-way delay values D₁₂ ^((i)) and D₂₁ ^((i)) to arrive at two sorted lists. These two lists may be trimmed to reject values that are too large based on the observed sample variance. Note that if such outlier rejection is used, it may only be applied to largest values, as those correspond to largest random delays. On the other hand, the smallest values correspond to small random delay components and may not be eliminated. After possible outlier rejection, individual offset estimates may be calculated using delay pairs with the same rank in the sorted lists:

Õ ^((i))=(D ₂₁ ^((i)) −D ₁₂ ^((i)))/2

The collection of values Õ^((i)) may be used to calculate the overall offset estimate through median, trimmed median, trimmed mean and/or other suitable estimation technique.

The system described herein advantageously allows utilizing synchronization message exchanges in which transmission time may be abnormal in one direction, but quite acceptable in the other. Offset estimates calculated from each of such message pairs would likely be outliers and thus useless for synchronization purposes. By separating the delays in both directions, the system provides for utilizing good one-way trips and rejecting the bad ones and thus using collected data more effectively. This allows using smaller number N of message exchanges and saves battery energy.

It may be possible to further save battery energy by providing synchronization information in connection with data exchanges between the wireless sensors 34-36 and the AP 32. In such a system, separate communication for synchronization between the sensors 34-36 and the AP 32 would be eliminated or at least reduced so as to reduce the number of times the sensor radio components need to be activated. Time synchronization information could be included with data acquisition information, thus reducing the amount of power used by the wireless sensors. This is explained in more detail below.

Referring to FIG. 24, a flow chart 800 illustrates steps performed by a wireless sensor for data collection in a system where synchronization information is provided in connection with data exchanges between the wireless sensors 34-36 and the AP 32. Processing begins at a first step 802 where the wireless sensor wakes up according to a setting of a low-accuracy timer. Providing a particular time at which a sensor is set to wake up is set as described elsewhere herein. In an embodiment herein, the wireless sensors 34-36 may each be provided with both a low-accuracy timer (for waking the sensor up) and a fine-accuracy timer, which, as described herein, may be used in connection with synchronizing data that has been collected. In an embodiment herein, the low-accuracy timer may use less energy than the fine-accuracy timer and may possibly have a larger drift and/or be less stable than the fine-accuracy timer. In some cases, timing for waking up may not need to be as finely synchronized as subsequent synchronization for data analysis.

Following the step 802 is a step 804 where the sensor notes the time corresponding to the fine-accuracy timer. Following the step 804 is a step 806 where the wireless sensor collects the data (e.g., component vibration data). Following the step 806 is a step 808 where the wireless sensor appends the fine-accuracy time to the collected data. Following the step 808 is a step 812 where the wireless sensor goes back to sleep. Following the step 812, processing is complete. Note that the wireless sensor may subsequently wake up to transmit the collected data (and the appended fine-accuracy timestamp) as described elsewhere herein.

Referring to FIG. 25, a flow chart 830 illustrates steps performed in connection with transferring data from one of the wireless sensors 34-36 to the AP 32 and, at the same time, performing synchronization of the one of the wireless sensors 34-36. Processing begins at a first step 832 where a number of data segments, NSEG, and a possible number of extra exchanges between the wireless sensor 34-36 and the AP 32, NEXTRA (described in more detail elsewhere herein), are set. As described in connection with FIG. 14 and the corresponding text, it is possible to determine a number of exchanges between the AP 32 and the wireless sensors 34-36 used to accurately synchronize the AP 32 with each of the wireless sensors 34-36. Part of this determination includes factoring in the expected message loss rate. Since the synchronization information is being provided with each of the data segments, then it is desirable to set the number of data segments, NSEG, equal to or larger than the number exchanges needed to synchronize the AP 32 with the wireless sensor. For example, if it is determined that five exchanges can be used to accurately synchronize the AP 32 and the wireless sensor, then NSEG may be set to five at the step 832, in which case the collected sensor data and time synchronization information may be provided to the AP in five segments.

Note that it is possible for the minimum number of exchanges necessary to appropriately synchronize the wireless sensor and the AP 32 to be more than a desired number of data segments. For example, if it is determined that twenty exchanges are necessary for synchronizing the wireless sensor and the AP 32, but there are only twenty (or less) bytes of data, then it may not be appropriate to set NSEG to twenty and send each byte of data in its own packet. In an embodiment herein, there may be a minimum packet size (and/or maximum number of packets) that is set based on operational factors such as packet overhead, desired transmission efficiency, etc. Generally, smaller packet sizes and larger packet overhead result in less data efficiency. Of course, a larger number of packets (larger NSEG) provides more opportunities to exchange synchronization information. Also, packet loss rates may need to be considered since relatively high packet loss rates may be handled by using relatively small packet sizes, which reduces packet loss rate and reduces the amount of data lost when a packet is lost. Note that, generally, the longer a packet is, the higher the probability that it will contain one or more corrupted bits so, for a high bit error rate, shorter messages are advantageous.

Of course, it is also possible that a reverse situation occurs where the size of the acquired data set is large enough so that the corresponding number of packets is larger than what is required for accurate synchronization. In such a case, the timestamp data may be appended only to a part (e.g. the initial part) of the transmitted data, or simply all data packets may be equipped with timestamps, which will result in better than necessary synchronization accuracy.

Processing at the step 832, where NSEG and NEXTRA are determined, is described in more detail elsewhere herein. Following the step 832 is a step 834 where an index variable, C, is set to one. The index variable, C, may be used to iterate through the data packets. Following the step 834 is a test step 326 where it is determined if the index variable, C, is greater than the number of segments (NSEG). If not, then control transfers from the step 836 to a step 838 where the AP 32 requests that the sensor transmit segment C. In an embodiment herein, the request includes a timestamp from the AP 32, which is returned to the AP 32 by the wireless sensor and then used to determine the timing offset of the wireless sensor, as described elsewhere herein. Also as discussed elsewhere herein, the wireless sensor may also return two timestamp values, a first indicating when the request was received by the wireless sensor (according to the wireless sensor's internal clock) and a second indicating when the data is being transmitted by the wireless sensor (also according to the wireless sensor's internal clock). These values may be used to determine the clock offsets.

Following the step 838 is a test step 842 where it is determined if the AP 32 has successfully received the requested data. If not, then control loops back to the step 838 to request the data again. Note that the steps 838, 842 may be performed according to the processing illustrated by the flow chart 270. If it is determined at the step 842 that the AP 32 has successfully received the requested data, then control transfers from the test step 842 to a step 844 where the index variable, C, is incremented. Following the step 844, control transfers back to the step 836 for another iteration.

If it is determined at the test step 836 that C is greater than NSEG, then control transfers from the test step 836 to a step 852 where an index variable, N, is set to one. The index variable N is used to iterate through the number of extra time synchronization exchanges, NEXTRA, determined at the step 832. Following the step 852 is a test step 854 where it is determined if N is greater than NEXTRA. If so, then control transfers from the test step 854 to a step 856 where the time synchronization offset is determined. Processing at the step 856 is described in more detail elsewhere herein. Following the step 856, processing is complete.

If it is determined at the test step 854 that N is not greater than NSEG, the control transfers from the test step 854 to the step 858, where the AP 32 sends a request to the wireless sensor to exchange timing information. The information that is exchanged is discussed in more detail elsewhere herein. Following the step 858 is a step 862 where the index variable, N, is incremented. Following the step 862, control transfers back to the step 854 for another iteration.

Note that the steps 852, 854, 856, 858, 892 correspond to the processing illustrated by the flow chart 550, except that some of the synchronization messages will have been exchanged prior to reaching the step 852 by appending the synchronization messages to data collection message exchanges, as explained above. Thus, the processing performed at the step 852 corresponds to the processing performed at the step 564, described above. In addition, it is possible for NEXTRA to be set to zero at the step 832, in which case no time synchronization exchanges are performed beyond the time synchronization exchanges appended to the data collection exchanges. Note also that, in an alternative embodiment, it is possible to transmit the additional synchronization exchanges prior to the AP 32 acquiring data from the wireless sensor rather than after.

Referring to FIG. 26, a flow chart 870 illustrates in more detail processing performed in connection with determining NSEG and NEXTRA at the step 832 in the flow chart 830, described above. Processing begins at a first step 872 where an initial value of NSEG is set according to a desired number of time synchronization exchanges, as explained in more detail elsewhere here (see, for example, FIG. 14 and the corresponding text, above). Following the step 872 is a test step 874 where it is determined if the resulting packet size, PS (PS=Total Data/NSEG+Packet Overhead), is less than a desired minimum packet size (PSMIN). The desired minimum packet size PSMIN may be determined based on a variety of factors as discussed in more detail elsewhere herein. If it is determined at the test step 874 that the packet size resulting from the initial value set for NSEG is not less than the minimum desired packet size, then control transfers from the test step 874 to a step 876, where NEXTRA is set to zero. In such a case, all timing synchronization exchanges are appended to data transfer exchanges, and it is not necessary to provide any additional timing synchronization exchanges. Following the step 876, processing is complete.

If it is determined at the test step 874 that the packet size (PS) resulting from the initial value set for NSEG (at the step 872) is less than the desired minimum packet size (PSMIN), then control transfers from the test step 874 to a step 878 where NSEG is set to the amount of data (from sensor data that has been collected) to be transferred divided by the minimum packet size minus packet overhead. For example, if there are sixty bytes of data to be transferred, the minimum packet size is twenty bytes, and there are five bytes of overhead per packet, then NSEG is four. Note that the AP 32 may know the amount of sensor data to be transferred either by querying the wireless sensor (not shown in FIG. 26) or because the AP 32 knows a priori how much data is transferred from each wireless sensor (e.g., table or chart) or the AP 32 uses information regarding the amount of data previously sent (e.g., averages the amounts), etc.

Following the step 878 is a step 882 where NEXTRA is set to the difference between the desired number of time synchronization exchanges (e.g. the initial value set for NSEG at the step 872) and the actual value for NSEG. Thus, for example, if the desired number of time synchronization exchanges is seven, and NSEG is set to four at the step 878, then NEXTRA is set to three (seven minus four) at the step 882. As discussed elsewhere herein, the AP 32 exchanges time synchronization information with the wireless sensor in connection with receiving NSEG segments worth of data from the wireless sensor. If needed, the AP 32 and wireless sensor perform NEXTRA additional time synchronization exchanges prior to or after exchanging sensor data. Following the step 882, processing is complete.

Referring to FIG. 27, a diagram 920 shows a first dataset 922 collected from a first wireless sensor (not shown in FIG. 27) and a second dataset 924 collected from a second wireless sensor (not shown in FIG. 27). Ideally, datasets from wireless sensors would be collected at the same time so that follow on processing can use synchronized data from different sensors. However, because of internal clock offsets, the datasets 922, 924 are actually collected at slightly different times. The diagram 920 shows the first dataset 922 is collected between times t1′ and t2′ while the second dataset 924 is collected between times t1″ and t2″. The times t1′, t2′, t1″, and t2″ may be understood as being relative to a single reference time, such as the time of the AP 32. That is, the times shown in FIG. 27 may be the adjusted times that are calculated after clock offsets are determined by the AP 32.

The system described herein may determine the sensor time offset information and then use the offset information to synchronize the data. In an embodiment herein, the system discards data from the first data segment 922 that does not correspond to data in the data segment 924 (i.e., data in the first data segment 922 that does not align with data in the second data segment 924 in the diagram 920). This is illustrated by a portion 926 of the data segment 922. Similarly, the system discards data from the second data segment 924 that does not correspond to data in the first data segment 922, which is illustrated by a portion 928 of the second data segment 924. Follow on processing may then use synchronized data from times t1″ to t2′ for both of the data segments 922, 924.

Note that, in some instances, it may be desirable to provide for data acquisition times that are longer than needed so as to account for data that is discarded. Note also that it may be possible to not discard any data at all but, instead, simply provide the time shift information to follow on processing to make appropriate compensation.

Referring to FIG. 28, a flow chart 940 illustrates processing performed by the AP 32 (or possibly other processes/devices that receive data from the AP 32) in connection with discarding data to provide synchronized data segments as illustrated by the diagram 920, discussed above. The processing illustrated by the flow chart 940 may be performed for any plurality of data segments, and is not restricted to only two. Processing begins at a first step 942 where the latest absolute start time (e.g., t1″ in the diagram 920) is determined. Following the step 942 is a step 944 where data for all data segments that is prior to the latest absolute start time is discarded. Following the step 944 is a step 946 where the earliest absolute end time for all of the data segments is determined. Following the step 946 is a step 948 where data for all of the data segments that is after the absolute end time is discarded. Following the step 948, processing is complete.

Note that, as an alternative to performing the processing illustrated by the flow chart 940, it may be possible instead to send synchronization commands to the wireless sensors to adjust the internal clocks thereof to cause the data to be collected at the same time (i.e., t1′ and t1″ of FIG. 27 would be the same). Sending clock adjustment commands is discussed in more detail elsewhere herein.

Referring to FIG. 29, a diagram 950 illustrates the system described herein where the AP 32 obtains data from sensors S1 and S2. On the left of the diagram, the AP 32 may command S1 and S2 to acquire data. This command may be provided at the end or beginning of the previous acquisition cycle (i.e., the processing illustrated by the flow chart 830, discussed above) or may be provided separately (e.g., at a prearranged time when S1 and/or S2 have their radio components turned on, as described elsewhere herein). It is also possible that S1 and/or S2 are preprogrammed to acquire data at predetermined times, and thus do not need further commands from the AP 32.

S1 and S2 subsequently collect data, according to their own internal clocks which, as described elsewhere herein, may be different. Following data acquisition, the AP 32 may use the processing described elsewhere herein to obtain the data from S1 and then, separately, from S2. The AP 32 then calculates the offset, as described in more detail elsewhere herein.

In some cases, it may be desirable to have the sensors perform synchronization rather than have synchronization performed by the AP 32. The AP 32 may still provide timestamp information so that the sensors synchronize themselves to the clock used by the AP 32. Note that if the sensors perform self-synchronization to the internal clock of the AP 32, the sensors will be synchronized to each other.

Referring to FIG. 30, a diagram 960 illustrates self-synchronization by a sensor. Just as with embodiments where the AP 32 handles synchronization, the sensor does not transmit anything unless requested by the AP 32. That is, even though the sensor is performing self-synchronization, the sensor still does not initiate communication with the AP 32 or otherwise send data without first receiving a request from the AP 32. As shown in FIG. 30, the AP 32 initiates communication with the sensor by sending a command or data request (hereinafter referred to as a command, for simplicity), which responds and provides timestamp values that are used in subsequent commands by the AP 32. This is described in more detail elsewhere herein.

Referring to FIG. 31, a flow chart 970 illustrates processing performed by the AP 32 in a system in which sensors perform self-synchronization. Processing begins at a first step 972 where the AP 32 sends a first command to the sensor. Following the step 972 is a step 974 where the AP 32 receives a first reply from the sensor. The first reply includes a timestamp, T1, which is the time when the sensor sends the first reply to the AP 32. Note that the AP 32 receives the first reply at a time T4 according to the AP 32.

Following the step 974 is a step 976 where the AP 32 sends a second command to the sensor. The second command is sent at the time T5 (according to the AP 32) and the AP 32 appends T5 as well as T1 and T4 (discussed above) to the second command. Following the step 976 is a step 978 where the AP 32 receives a second reply from the sensor. Note that the second reply from the sensor does not contain any timestamps because the sensor has already performed self-synchronization using the T1, T4, and T5 timestamps. The specific processing performed by the sensor for self-synchronization is discussed in more detail elsewhere herein. Following the step 978, processing is complete.

Referring to FIG. 32, a flow chart 980 illustrates steps performed by a sensor in connection with self-synchronization thereof. Processing begins at a first step 982 where the sensor receives the first command from the AP 32. Following the step 982 is a step 984 where the sensor sends the first reply to the AP 32. The first reply includes the timestamp T1, the time that the first reply is sent by the sensor. Inclusion of the timestamp T1 represents a synchronization request from the sensor. Alternatively, the sensor may provide a synchronization request to the AP 32 by including a different indicator with data/status being returned by the sensor. Following the step 984 is a step 986 where the sensor receives the second command from the AP 32. As discussed elsewhere herein, the second command includes the timestamp T1 as well as the timestamps T4 and T5, where T4 is the time that the AP 32 receives the first reply from the sensor and T5 is the time that the AP 32 sends the second command.

Following the step 986 is a step 988 where the sensor performs self-synchronization using T1, T4, and T5 as well as T8, the timestamp indicating the arrival time (according to the sensor) of the second command at the sensor. Any appropriate technique may be used for self-synchronization at the step 988. In an embodiment herein, the offset is determined by the formula:

Offset=((T4−T1)−(T8−T5))/2

which assumes that the transmission time from the AP 32 to the sensor (T4−T1) is equal to the transmission time from the sensor to the AP 32 (T8−T5). Note that the time between T4 and T5 (the time between command/response sequences) does not matter. Following the step 988 is a step 992 where the sensor sends the second reply to the AP 32. As discussed elsewhere herein, the second reply does not contain any timestamp information. Following the step 992, processing is complete.

As discussed elsewhere herein, it may be useful to obtain multiple timestamps to improve the accuracy of the synchronization. In such a case, there may be more than two command/reply exchanges between the sensor and the AP 32 (exchanging timestamp values, as appropriate) in connection with the sensor performing self-synchronization. The sensor may send a message back to the AP 32 indicating that additional exchanges are requested for performing self-synchronization. In some cases, the sensor may send a response to the AP 32 requesting a particular number of exchanges in a subsequent data acquisition iteration. Alternatively, the AP 32 may be able to determine (and provide without indication from the sensors) the number of exchanges needed for appropriate resolution/accuracy of the synchronization.

Note that it is possible for multiple sensors to be performing self-synchronization at the same time or nearly the same time, and that commands and replies from and to the AP 32 from different sensors may be interleaved. Note also that the command and replies may be status requests, sensor data requests, etc. In some embodiments, each sensor data transmission may include timestamp information and be considered an implied sensor synchronization request. In some cases, all or nearly all exchanges between the sensor(s) and the AP 32 may include timestamp(s) that may be used by the sensor for self-synchronization.

In some embodiments, no timestamp information is provided from the sensor(s) to the AP 32. Instead, the sensor(s) may internally note the timestamp information (e.g., T1) and then use the information later when it is time to perform self-synchronization. In addition, in systems where different sensors and/or different types of sensors need different levels/types of synchronization, each sensor can provide its own appropriate self-synchronization. Any of the synchronization techniques for the AP 32 described herein may be adapted for use with the sensor self-synchronization technique described herein.

Various embodiments discussed herein may be combined with each other in appropriate combinations in connection with the system described herein. Additionally, in some instances, the order of steps in the flowcharts may be modified, where appropriate. Further, the system described herein may be implemented using software, hardware, and/or a combination of software and hardware. Software implementations of the system described herein may include executable code that is stored in a computer readable storage medium and executed by one or more processors. The computer readable storage medium may include a computer hard drive, ROM, RAM, flash memory, portable computer storage media such as a CD-ROM, a DVD-ROM, a flash drive and/or other drive with, for example, a universal serial bus (USB) interface, and/or any other appropriate tangible storage medium or computer memory on which executable code may be stored and executed by a processor. The system described herein may be used in connection with any appropriate operating system.

Other embodiments of the invention will be apparent to those skilled in the art from a consideration of the specification or practice of the invention disclosed herein. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the invention being indicated by the following claims. 

1. A method for synchronizing a wireless sensor, comprising: receiving a first command at the wireless sensor; responding to the first command with a first reply; noting a first timestamp value indicating when the first reply is sent; receiving a second command at the wireless sensor that contains a second timestamp value indicating when the first reply was received and a third timestamp value indicating when the second command was sent to the wireless sensor; noting a fourth timestamp value indicating when the second command was received by the wireless sensor; and determining an offset at the wireless sensor using the first, second, third, and fourth timestamp values.
 2. A method, according to claim 1, wherein the offset is determined using the formula: Offset=((the second timestamp value minus the first timestamp value)−(the fourth timestamp value minus the third timestamp value))/2
 3. A method, according to claim 1, wherein the first timestamp value is provided with the first reply.
 4. A method, according to claim 3, wherein the presence of the first timestamp value is interpreted as a request to provide timestamp information for synchronization.
 5. A method, according to claim 1, wherein an access point communicates with the wireless sensor.
 6. A method, according to claim 5, wherein the second timestamp value is the time that the first reply is received by the access point and wherein the third timestamp value is the time that the second command is sent by the access point.
 7. A method, according to claim 5, wherein the wireless sensor is synchronized according to a clock of the access point.
 8. A method, according to claim 1, wherein the first command is a request to collect data.
 9. A method according to claim 8, wherein the wireless sensor is one of a plurality of wireless sensors, and wherein each of the wireless sensors collects data in synchronization with other ones of the wireless sensors.
 10. A method, according to claim 9, wherein exchanges for synchronizing the wireless sensors overlap.
 11. A method, according to claim 1, wherein the first reply indicates a requested number of exchanges.
 12. A method, according to claim 1, wherein substantially all commands received by the wireless sensor include timestamp values.
 13. Computer software, provided in a non-transitory computer-readable medium, that synchronizes a wireless sensor, comprising: executable code that receives a first command at the wireless sensor; executable code that responds to the first command with a first reply; executable code that notes a first timestamp value indicating when the first reply is sent; executable code that receives a second command at the wireless sensor that contains a second timestamp value indicating when the first reply was received and a third timestamp value indicating when the second command was sent to the wireless sensor; executable code that notes a fourth timestamp value indicating when the second command was received by the wireless sensor; and executable code that determines an offset at the wireless sensor using the first, second, third and fourth timestamp values.
 14. Computer software, according to claim 13, wherein the offset is determined using the formula: Offset=((the second timestamp value minus the first timestamp value)−(the fourth timestamp value minus the third timestamp value))/2
 15. Computer software, according to claim 13, wherein the first timestamp value is provided with the first reply.
 16. Computer software, according to claim 13, wherein the second timestamp value is the time that the first reply is received by an access point that communicates with the wireless sensor and wherein the third timestamp value is the time that the second command is sent by the access point.
 17. Computer software, according to claim 13, wherein the wireless sensor is synchronized according to a clock of an access point that communicates with the wireless sensor.
 18. Computer software, according to claim 13, wherein the wireless sensor is one of a plurality of wireless sensors and wherein exchanges for synchronizing the wireless sensors overlap.
 19. Computer software, according to claim 13, wherein the first reply indicates a requested number of exchanges.
 20. Computer software, according to claim 13, wherein substantially all commands received by the wireless sensor include timestamp values. 